package com.geezdata.cps.base.enums;

import java.util.List;

import com.geezdata.cps.base.exceptions.MyException;
import com.google.common.collect.Lists;

public enum PlatformEnum {
	TAOBAO("taobao"),  					//淘宝
	TMALL_i18n("tmall_guoji"),   		//天猫国际
	TAOBAO_FENXIAO("taobao_fenxiao"),  	//淘宝分销
	JOS("jd"),   						//京东
	JOS_OVERSEAS("jd_guoji"),  			//京东海外
	PINDUODUO("pinduoduo"),   				//拼多多
	WYETH_WEIXIN("wyeth_weixin"), 		//惠氏微信
	HAOQI_WEIXIN("haoqi_weixin"), 		//好奇微信
	KAOLA("kaola"),   					//考拉海购
	MIYA("miya"),    					//蜜芽
	YOUZAN("youzan"),  					//口袋通
	UDH("udh");  						//UDH 乐其会员积分商城
	
	private final String name; 
	
	private final static List<String> orderPlatforms = Lists.newArrayList();
	static {
		orderPlatforms.add(PlatformEnum.PINDUODUO.getName());
		orderPlatforms.add(PlatformEnum.TAOBAO.getName());
	}  
	
	private PlatformEnum(String name) {
        this.name = name;
    }
	
	public String getName() {
		return name;
	}
	
	@Override
	public String toString() {
		return this.name;
	}
	
	public static PlatformEnum getByName(String name) {
        for (PlatformEnum platform : values()) {
            if (platform.getName().equals(name)) {
                return platform;
            }
        }
        throw new MyException(ErrorCode.INTERNAL_SERVER_ERROR.getCode(), "平台枚举值错误:" + name);
    }
	
	public static List<String> getOrderPlatformList() {
		return orderPlatforms;
	}
}